﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;
using Db4objects.Db4o;

namespace States
{
    public class DataBase
    {
        readonly static string DBFileName =
            Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "States.db4o");

        public static string BDFile
        {
            get
            {
                return DBFileName;
            }
        }

        public static bool ClearDataBase()
        {
            try
            {
                File.Delete(BDFile);
                using (IObjectContainer db = Db4oEmbedded.OpenFile(BDFile))
                {
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
